#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct 
{
	int x, y;
	double at;
} Vec;

Vec v[300];

int cp(const void *a, const void *b)
{
	Vec *aa = (Vec*)a;
	Vec *bb = (Vec*)b;
	if (aa->at > bb->at)
	{
		return 1;
	}
	return -1;
}

int main()
{
	int i, N;
	int x, y;
	double max, tmp;

	while (scanf("%d", &N) != -1 && N)
	{
		for (i = 0; i < N; i++)
		{
			scanf("%d %d", &x, &y);
			
			if (y < 0)
			{
				v[i].x = -x;
				v[i].y = -y;
			}
			else if (y == 0)
			{
				v[i].x = (x > 0) ? x : -x;
				v[i].y = 0;
			}
			else
			{
				v[i].x = x;
				v[i].y = y;
			}
			v[i].at = atan2(v[i].y, v[i].x);
		}
		qsort(v, N, sizeof(v[0]), cp);
		for (x = 0, y = 0, i = 0; i < N; i++)
		{
			x += v[i].x;
			y += v[i].y;
		}
		max = x * x + y * y;
		for (i = 0; i < N; i++)
		{
			x = x - 2 * v[i].x;
			y = y - 2 * v[i].y;
			tmp = 1.0 * x * x + 1.0 * y * y;
			if (tmp > max)
			{
				max = tmp;
			}
		}
		printf("Maximum distance = %.3lf meters.\n", sqrt(max));
	}
	return 0;
}
